package com.ti.winona.ui;

import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
import com.taplinker.client.R;
import com.ti.winona.ui.fragment.HomeFragment;
import com.ti.winona.ui.fragment.MenuLeftFragment;
import com.ti.winona.util.FragmentOperateUtil;

import android.os.Bundle;

public class MainActivity extends BaseSlidingFragmentActivity {
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		initSlidingMenu();		// 设置SlidingMenu
		addLeftMenuFragment();	// 添加leftMenu
		addMainFragment();		// 添加主界面HomeFragment
		
		setContentView(R.layout.activity_main);
	}
	
	private void initSlidingMenu() {
		getSlidingMenu().setMode(SlidingMenu.LEFT);
		getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
	}
	
	private void addLeftMenuFragment() {
		FragmentOperateUtil.replaceFragment(getSupportFragmentManager(), MenuLeftFragment.class, R.id.menu_frame, MenuLeftFragment.TAG, null, true);
	}
	
	private void addMainFragment() {
		FragmentOperateUtil.replaceFragment(getSupportFragmentManager(), HomeFragment.class, R.id.main_frame, HomeFragment.TAG, null, true);
	}

}
